import '../static/css/weui.css'
import './css/public.css'
import Vue from 'vue'
import App from './App'
import dialog from '@/utils/dialog'
import cookie from '@/utils/cookie'
Vue.config.productionTip = false
App.mpType = 'app'

const app = new Vue(App)
app.$mount()
const globalData = getApp().globalData

let systemInfo = wx.getSystemInfoSync()
globalData.store = {
  sdkVersion: systemInfo.SDKVersion,
  ipx: (systemInfo.model.substring(0, systemInfo.model.indexOf('X') + 1)) === 'iPhone X'
}
// 全局数据
Vue.prototype.globalData = globalData

// 弹窗
Vue.prototype.dialog = dialog

Vue.prototype.cookie = cookie

// 返回上一级
Vue.prototype.navigateBack = function (delta = 1) {
  const arr = getCurrentPages() // eslint-disable-line
  if (arr.length >= 2) {
    wx.navigateBack({ delta })
  } else {
    wx.reLaunch({ url: '/pages/home/main' })
  }
}
Vue.prototype.goStatusPage = function (status, msg) {
  wx.redirectTo({
    url: `/pages/status/main?status=${status}&msg=${msg}`
  })
}
